package Book;

//书架，存放多本图书
public class BookList {
    //通过Book类型的数组组织图书  可以存放10本书
    private Book[] books = new Book[10];
    private int usedSize;//计数器  用来记录当前实际存放图书的数量 默认是0
    //构造方法

    public BookList() {
        //通过构造方法给书架初始化，默认存放3本书
        this.books[0] = new Book("西游记","吴承恩",88,"小说");
        this.books[1] = new Book("三国演义","罗贯中",80,"小说");
        this.books[2] = new Book("红楼梦","曹雪芹",85,"小说");
        this.usedSize = 3;
    }
    //获取或修改计数器的值
    public int getUsedSize() {
        return usedSize;
    }

    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }
    //给一个下标，返回该下标的图书
    public Book getBook(int pos) {
        return books[pos];
    }
    //给某个下标放书
    public void setBook(int pos,Book book) {
        books[pos] = book;
    }

}
